/*
 * Copyright (c) 2011 Team A CS2340. All rights reserved.
 */

//TODO: Re-enable audit
// $codepro.audit.disable
package edu.gatech.teama.doctorsoffice.server;

import java.sql.*;

import edu.gatech.teama.doctorsoffice.model.SystemAdmin;
import edu.gatech.teama.doctorsoffice.model.User;

public class DBTest  {


	public static void main(String[] args) throws SQLException{

		User testUser = new SystemAdmin("userTuesday", "UserFirst", "UserLast");

		DBConnector DBconn=new DBConnector();
		
		System.out.println(DBconn.addUser(testUser,"testUserPass","Patient"));
		
		System.out.println(DBconn.addAppointment("userTuesday", "1/1/2011", "12:30", "Smith", null, null));
		//System.out.println(DBconn.addUser(admin,"adminPass","SysAdmin"));
		//int i=5;
		//String pass="adminPass1";
		//while(i>0){
		//	if (i==3)
		//		pass="adminPass";
		//	System.out.println(DBconn.login("admin", pass));
		//	i--;}
		//		OracleDataSource ods= new OracleDataSource();
		//		String user="testUser";
		//		String pass="testPass";	
		//		ods.setURL("jdbc:oracle:thin:" + "ops$sball7"+"/"+"cs2340"+"@"+"acme.gatech.edu:1525:public");
		//		Connection conn=ods.getConnection();
		//		conn.setAutoCommit(false);
		//		Statement stmt=conn.createStatement();
		//		String username="testtset";
		//		//String pass="testpass";
		//		String obj="obje";
		//		//stmt.executeUpdate("CREATE TABLE userlist1 ("+"username varchar2(10) not null,"
		//		//		+"pass varchar2(30) not null,"+
		//		//		"object varchar2(30) not null)");
		//		PreparedStatement stmt2=conn.prepareStatement("insert into userlist1 values(" +
		//				"? , ? , ?)");
		//		stmt2.setString(1, username);
		//		stmt2.setString(2,pass);
		//		stmt2.setString(3,obj);
		//		
		//		//stmt2.executeUpdate();
		//		//String findUserStmt="select username from userlist1 where username=";
		//		PreparedStatement stmt3=conn.prepareStatement("select pass from userlist1 where username=?");
		//		stmt3.setString(1,"admin");
		//		String verify="pass";
		//		ResultSet rset1=stmt3.executeQuery();
		//		//ResultSetMetaData rsmd=rset1.getMetaData();
		//		//System.out.println(rsmd.getColumnName(1));
		//		
		//		//while(rset1.next()){
		//		//	System.out.println(rset1.getString(1));}
		//		rset1.next();
		//		String result=rset1.getString(1);
		//		System.out.println(verify.equals(result));
		//		conn.commit();
		//		conn.setAutoCommit(true);
		//		conn.close();

	}


}